<?php
require '../vendor/autoload.php';

/**
 * Prompt ends with a colon.
 */
function inputc($prompt)
{
    return input($prompt . ': ');
}

function main()
{
    $border_upper = inputc('Please enter the upper border length which trapezium you want to calculate the area of');
    $border_lower = inputc('Please enter the lower border length which trapezium you want to calculate the area of');
    $altitude = inputc('Please enter the altitude length which trapezium you want to calculate the area of');

    if (is_numeric($border_upper)
        && is_numeric($border_lower)
        && is_numeric($altitude)
    ) {
        disp('The area of the trapezium is ' . ($border_upper + $border_lower) * $altitude / 2 . '.');
    }
}

main();
